﻿define(['util', 'ajax'], function (util, ajax) {
    "use strict";

    var exports = {},
         ViewModel;  

    ViewModel = function (model) {
        var self = this;
        var data = model.detail;
        
        self.id = ko.observable(data.id);
        self.name = ko.observable(data.name);
        self.memberCode = ko.observable(data.memberCode);
        self.userId = ko.observable(data.userId);
        self.memberName = ko.observable(data.memberName);
        self.startTime = data.startTime == null ? '-' : ko.observable(moment.utc(data.startTime).format("MM/DD/YYYY hh:mm:ss"));
        self.endTime = data.endTime == null ? '-' : ko.observable(moment.utc(data.endTime).format("MM/DD/YYYY hh:mm:ss"));
        self.taskStatusName = ko.observable(data.taskStatusName);
        self.description = ko.observable(data.description);
    };

    exports.exec = function (sectionId, model) {
        var viewModel = new ViewModel(model);
        ko.applyBindings(viewModel, document.getElementById(sectionId));
    };

    return exports;
});